package com.example.learningvaadinsvn;

import com.example.exercises.ExerciseOne;
import com.example.modules.MainModule;
import com.vaadin.Application;
import com.vaadin.ui.*;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;

public class LearningvaadinsvnApplication extends Application {
	/**
	 * @ElectroGio: Serial Version 1L
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public void init() {
		setTheme("electrogio");
		final Window mainWindow = new Window("Learningvaadinsvn Application");
		MainModule mainModule = new MainModule();

		ExerciseOne exOne = new ExerciseOne();

		exOne.getBtn().addListener(new ClickListener() {

			public void buttonClick(ClickEvent event) {
				Window newWindow = new Window("Example");
				Panel pan = new Panel();
				Label lab = new Label();
				lab.setContentMode(Label.CONTENT_XHTML);
				lab.setValue("<b>ElectroGio</b>");
				pan.addComponent(lab);
				newWindow.addComponent(pan);

				mainWindow.addWindow(newWindow);

			}
		});

		mainModule.getPnlExercise().addComponent(exOne);

		mainWindow.addComponent(mainModule);
		setMainWindow(mainWindow);
	}

}
